package cn.lg.soar.activiti.feign.fallback;

import cn.lg.soar.activiti.api.model.*;
import cn.lg.soar.activiti.feign.ActivitiApiFeign;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;

import java.util.Collection;
import java.util.List;

/**
 * 文件上传接口
 * @author luguoxiang
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
public class ActivitiApiFallbackFactory implements FallbackFactory<ActivitiApiFeign> {

    protected static final Logger LOGGER = LoggerFactory.getLogger(ActivitiApiFallbackFactory.class);
    @Override
    public ActivitiApiFeign create(Throwable cause) {
        return new ActivitiApiFeign() {
            @Override
            public ProcessInstanceDTO startProcess(StartProcessDTO dto) {
                LOGGER.error("startProcess，{}", dto, cause);
                return null;
            }

            @Override
            public void completeTask(CompleteTaskDTO dto) {
                LOGGER.error("completeTask，{}", dto, cause);
            }

            @Override
            public List<TaskDTO> tasks(String processKey, Collection<String> businessIds, Collection<String> candidates) {
                LOGGER.error("tasks，{}, {}", processKey, businessIds, cause);
                return null;
            }

            @Override
            public List<HistoryTaskDTO> historyTasks(String processKey, String businessId) {
                LOGGER.error("historyTasks，{}, {}", processKey, businessId, cause);
                return null;
            }

        };
    }
}
